/*
 *  cload.h
 *  EPPI-0.0
 *
 *  Created by Juan Carlos Garcia Orden on 15/11/07.
 *
 */

#ifndef _cload_h_
#define _cload_h_

#include "component.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include "commonutil.h"

using namespace std;

class CLoad : public Component
{
private:
	vector<double> value;
	int numDofsOnePoint;
/*	Data members from the base class Component
	int dim;
	int numDofs;
	vector<string> pointNames;
	map<string,Point*,less<string> > mPoints;
	vector<int> localGlob;
	double time;
	string matName;
	vector<double> q;
	vector<double> dq;
	vector<double> qC;
	vector<double> dqC;
	vector<double> Fi;
	vector<double> Fq;
	vector<double> Ft;
	vector< vector<double> > Ki; 
	vector< vector<double> > Kq;
	vector< vector<double> > Kdq;	
 	vector< vector<double> > M;		// Local contribution to the mass matrix
	double perturbation;	//For numerical differentiation
	int integratorType;
	double thetab;			// Ambient temperature
*/

public:
	CLoad();
	CLoad(ifstream &, string, int, const map<string,vector<string>,less<string> >*);
	~CLoad(){}	

	/** Virtual functions from base */
	void setDofs(void);
//*	void initializeGlobalDofs(lmx::Vector<double> &);
// 	void initializeGlobalDofs(vector<double> &);
	void initializeGlobalDofs(vector<double> &, vector<double> &, const double & );
	void calcFi(const vector<double>&);
	void calcFq(const int&);
	void calcFt(const double&, const double&, const int&);
	void calcKi(double&);
	void calcKq(int);
	void calcKdq(double&);
	void calcM(const vector<double>&, const double &);
	void calcMLumped(const vector<double>&, const double &);
	void setMatAtComp(Material*);
	string getMatName()	{return 0;}
	void initializeCompRes(const bool&, const double&, const int&, const bool);
//	void initializeCompTang(const bool&, const bool&);
	void initializeCompTang(const bool&);
	void calcEner(double&, double&, double&, double&, double&, double&, double&, int&, vector<double>&, vector<double>&);
	void calcEntropy(double&, double&);
	void calcAM(vector<double>&, vector<double>&, vector<double>&);
	void updateComp(void);
	void setInitialConditions(vector<double>&, vector<double>&){}
	double getTemperature(void){};
	void setIniDofs(vector<double>&);
	void calcPhi(const vector<double>&);
	void calcDPhi(const vector<double>&);
	void calcMSmooth(const vector<double>&, const double&);
	void calcFSmooth(const vector<double>&, const vector<double>&, const double&);
	int checkState(void);
	
	/** Local functions */

	friend string getStringHead(const string& str);
	friend bool checkForSlash(const string& str);
	friend void addSystemName(string& str, const string& strname);
	
};

#endif
